package com.mission.schedule.CommonDialog;

import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.StyleRes;
import android.text.TextUtils;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import com.google.gson.Gson;
import com.lidroid.xutils.HttpUtils;
import com.lidroid.xutils.exception.HttpException;
import com.lidroid.xutils.http.RequestParams;
import com.lidroid.xutils.http.ResponseInfo;
import com.lidroid.xutils.http.callback.RequestCallBack;
import com.lidroid.xutils.http.client.HttpRequest.HttpMethod;
import com.mission.schedule.R;
import com.mission.schedule.activity.PhoneCodeLoginActivity;
import com.mission.schedule.applcation.App;
import com.mission.schedule.bean.CalenderNoteBean;
import com.mission.schedule.bean.qd606.NoteTitleDetailBean;
import com.mission.schedule.constants.Const;
import com.mission.schedule.constants.ShareFile;
import com.mission.schedule.constants.URLConstants;
import com.mission.schedule.service.NoteService;
import com.mission.schedule.utils.DateUtil;
import com.mission.schedule.utils.NetUtil;
import com.mission.schedule.utils.ProgressUtil;
import com.mission.schedule.utils.SharedPrefUtil;
import com.mission.schedule.view.PageView;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.List;

/**
 * 清单子项对话框
 * Created by liwei on 2017/4/18.
 */

public class NoteChildMenuDialog extends Dialog {


    CallBack callBack;

    SharedPrefUtil sharedPrefUtil;
    Context context;
    WindowManager windowManager;

    String UserId = "";
    ProgressUtil progressUtil;
    NoteTitleDetailBean.TDelListBean beanss;
    PageView pageView;
    ImageView yd1, yd2;

    public NoteChildMenuDialog(@NonNull final Context context, @StyleRes final int themeResId,
                               final WindowManager windowManager,
                               final NoteTitleDetailBean.TDelListBean bean) {
        super(context, themeResId);
        this.context = context;
        this.windowManager = windowManager;
        this.beanss = bean;

        setCanceledOnTouchOutside(true);
        sharedPrefUtil = new SharedPrefUtil(context, ShareFile.USERFILE);
        UserId = sharedPrefUtil.getString(context, ShareFile.USERFILE, ShareFile.USERID, "");
        progressUtil = new ProgressUtil();
        View view = LayoutInflater.from(context).inflate(R.layout.dialog_note_type_child_menu, null);
        setContentView(view);

        pageView = view.findViewById(R.id.pageview);
        yd1 = view.findViewById(R.id.yd1);
        yd2 = view.findViewById(R.id.yd2);

        View view1 = LayoutInflater.from(context).inflate(R.layout.dialog_note_type_child_menu1, null);
        View view2 = LayoutInflater.from(context).inflate(R.layout.dialog_note_type_child_menu2, null);

        pageView.addPage(view1);
        pageView.addPage(view2);

        pageView.setCallBack(new PageView.CallBack() {
            @Override
            public void pageIndex(int position) {
                if (position == 0) {
                    yd1.setBackground(context.getResources().getDrawable(R.drawable.calender_new_detail_yd2));
                    yd2.setBackground(context.getResources().getDrawable(R.drawable.calender_new_detail_yd1));
                } else {
                    yd1.setBackground(context.getResources().getDrawable(R.drawable.calender_new_detail_yd1));
                    yd2.setBackground(context.getResources().getDrawable(R.drawable.calender_new_detail_yd2));
                }
            }
        });

        TextView common = view1.findViewById(R.id.common);
        if (bean.openState == 0) {
            common.setText("设为公开");
        } else if (bean.openState == 1) {
            common.setText("设为私密");
        }

        common.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (sharedPrefUtil.getString(context,
                        ShareFile.USERFILE, ShareFile.ISNEWYOUKE, "0").equals("-1")) {
                    App.getDBcApplication().updateNoteTitleOpenState(UserId, bean.titleId, bean.openState == 1 ? 0 : 1);
                    if (NetUtil.getConnectState(context) != NetUtil.NetWorkState.NONE) {
                        updateBeanToJson(bean.titleId);
                    } else {
                        Toast.makeText(context, "网络异常", Toast.LENGTH_SHORT).show();
                    }
                } else {
                    Intent newt = new Intent(context, PhoneCodeLoginActivity.class);
                    newt.putExtra("type", 1);
                    newt.putExtra("login", true);
                    context.startActivity(newt);
                }
            }
        });

        view1.findViewById(R.id.zhaunfahaoyou).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                callBack.notezhuanfa();
                dismiss();
            }
        });
        view2.findViewById(R.id.weixin).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                callBack.weixin();
                dismiss();
            }
        });
        view1.findViewById(R.id.copy_title).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                callBack.copytitle();
                dismiss();
            }
        });
        view1.findViewById(R.id.delete).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                callBack.delete();
                dismiss();
            }
        });
        view1.findViewById(R.id.top).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                callBack.top();
                dismiss();
            }
        });
        view2.findViewById(R.id.copy_myzone).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (sharedPrefUtil.getString(context,
                        ShareFile.USERFILE, ShareFile.ISNEWYOUKE, "0").equals("-1")) {
                    updateBeanToJsonzone(bean.titleId);
                } else {
                    Intent newt = new Intent(context, PhoneCodeLoginActivity.class);
                    newt.putExtra("type", 1);
                    newt.putExtra("login", true);
                    context.startActivity(newt);
                }
            }
        });
        view1.findViewById(R.id.select_color).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
                CalenderColorDialog colorDialog = new CalenderColorDialog(context, R.style.dialog_translucent, windowManager, "", 0);
                colorDialog.show();
                colorDialog.setCallBack(new CalenderColorDialog.CallBack() {
                    @Override
                    public void reminderEditTime(String color_position_f, String color_position) {
                        App.getDBcApplication().updateNoteTitleColor(bean.titleId, color_position_f, color_position);
                        callBack.updateColor(color_position_f, color_position);
                    }
                });
            }
        });
        view1.findViewById(R.id.copy_new).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
                RiLiDialog riLiDialog = new RiLiDialog(context, themeResId, windowManager);
                riLiDialog.show();
                riLiDialog.setCallBack(new RiLiDialog.CallBack() {
                    @Override
                    public void selectDate(String date) {
                        List<NoteTitleDetailBean.ListBean> listBeanList = App.getDBcApplication().getTitleNoteDetailData(UserId, bean.titleId, false);
                        App.getDBcApplication().insertScheduleData(1,
                                bean.titles.isEmpty() ? "无标题" : bean.titles,
                                date, "23:59", 1, 0, 0, 1, 0, 0, 0,
                                date + " 23:59", "", 2, bean.titleId, "0", 0, "", "",
                                0, 0, 0, "完成任务", "g_88", "", 0, 0, 0, "", "", 0, 0, 0);

                        for (NoteTitleDetailBean.ListBean listBean: listBeanList) {
                            CalenderNoteBean.PageBean.ItemsBean itemsBean = new CalenderNoteBean.PageBean.ItemsBean();
                            itemsBean.titleId = bean.titleId;
                            itemsBean.uid = Integer.valueOf(UserId);
                            itemsBean.id = App.getDBcApplication().getCalenderMinId() - 1;
                            itemsBean.style = listBean.style;
                            itemsBean.changeTime = DateUtil.nowTime();
                            itemsBean.createTime = DateUtil.nowTime();
                            itemsBean.ltype = listBean.lType;
                            itemsBean.orderId = listBean.orderId;
                            itemsBean.endstate = listBean.endstate;
                            itemsBean.remark = "";
                            itemsBean.contents = listBean.contents;
                            itemsBean.titles = bean.titles.isEmpty() ? "无标题" : bean.titles;
                            itemsBean.imgPath = bean.imgPath;
                            itemsBean.imgUrl = "";
                            itemsBean.cpath = "";
                            itemsBean.curl = "";
                            itemsBean.sdesc = "";
                            itemsBean.nums = "";
                            itemsBean.localIds = listBean.id+"";
                            itemsBean.shareUrl = "";
                            itemsBean.remark1 = "";
                            itemsBean.remark2 = "";
                            itemsBean.remark3 = "";
                            itemsBean.remark4 = "";
                            itemsBean.remark5 = "";
                            itemsBean.remark6 = "";

                            App.getDBcApplication().saveCalederNoteDetailData(itemsBean);
                        }

                        Intent intent = new Intent(Const.SHUAXINDATA);
                        intent.putExtra("data", "success");
                        intent.putExtra("index", 1);
                        intent.putExtra("what", 2);
                        context.sendBroadcast(intent);

                        Toast.makeText(context, "添加成功", Toast.LENGTH_SHORT).show();
                    }
                });
            }
        });


    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Window window = getWindow();
        WindowManager.LayoutParams params = window.getAttributes();
        window.setGravity(Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL);
        params.width = windowManager.getDefaultDisplay().getWidth() - 30;
        params.height = ViewGroup.LayoutParams.WRAP_CONTENT;
        window.setAttributes(params);
    }

    public interface CallBack {
        void updateNoteChildType(int styleid);

        void notezhuanfa();

        void weixin();

        void copytitle();

        void delete();

        void top();

        void common(int openState, boolean success);

        void copy_myzone();

        void updateColor(String color_position_f, String color_position);
    }

    public CallBack getCallBack() {
        return callBack;
    }

    public void setCallBack(CallBack callBack) {
        this.callBack = callBack;
    }


    private void updateBeanToJson(String titleid) {
        progressUtil.ShowProgress(context, true, true, "正在修改设置信息...");
        //标题
        JSONObject tDelListBeanListjsonObject = new JSONObject();
        try {
            NoteTitleDetailBean.TDelListBean bean = App.getDBcApplication().getOneNoteTitlesData(UserId, titleid, false);
            JSONArray tDelListBeanListjsonArray = new JSONArray();
            JSONObject js = new JSONObject();
            js.put("id", bean.id);
            js.put("titleId", bean.titleId);
            js.put("uid", bean.uid);
            js.put("titles", bean.titles);
            js.put("imgPath", bean.imgPath);
            js.put("imgUrl", bean.imgUrl);
            js.put("shareUrl", bean.shareUrl);
            js.put("filed", bean.filed);
            js.put("nums", bean.nums);
            js.put("copys", bean.copys);
            js.put("styles", bean.styles);
            js.put("ltype", bean.ltype);
            js.put("orderId", bean.orderId);
            js.put("createTime", bean.createTime);
            js.put("changeTime", bean.changeTime);
            js.put("localTimes", bean.localTimes);
            js.put("remark", bean.remark);
            js.put("remark1", bean.remark1);
            js.put("remark2", bean.remark2);
            js.put("remark3", bean.remark3);
            js.put("puid", bean.puid);
            js.put("pname", bean.pname);
            js.put("states", bean.states);
            js.put("sends", bean.sends);
            js.put("openState", bean.openState);
            js.put("updateState", bean.id < 0 ? 1 : App.getDBcApplication().getNoteTitleState(bean.titleId, UserId));
            tDelListBeanListjsonArray.put(js);

            if (bean != null) {
                tDelListBeanListjsonObject.put("classTitle", tDelListBeanListjsonArray);
            } else {
                tDelListBeanListjsonObject = null;
            }

        } catch (JSONException e) {
            e.printStackTrace();
        }

        uploadNoteData(tDelListBeanListjsonObject == null ? "" : tDelListBeanListjsonObject.toString());


    }


    /**
     * 上传清单数据
     *
     * @param dataTitle
     */
    private void uploadNoteData(String dataTitle) {
        HttpUtils httpUtils = new HttpUtils(10000);
        RequestParams params = new RequestParams();
        params.addBodyParameter("data", "");
        params.addBodyParameter("dataTitle", dataTitle);
        httpUtils.send(HttpMethod.POST, URLConstants.清单和清单标题上行, params,
                new RequestCallBack<String>() {

                    @Override
                    public void onFailure(HttpException e, String msg) {
                        Log.e("TAG", "清单同步失败" + msg);
                        progressUtil.dismiss();
                        dismiss();
                        callBack.common(beanss.openState == 1 ? 1 : 0, false);
                        Toast.makeText(context, "修改失败", Toast.LENGTH_SHORT).show();
                    }

                    @Override
                    public void onSuccess(ResponseInfo<String> responseInfo) {
                        if (!TextUtils.isEmpty(responseInfo.result)) {
                            Gson gson = new Gson();
                            NoteService.noteSynBean bean = gson.fromJson(responseInfo.result, NoteService.noteSynBean.class);
                            if (bean.status == 0) {
                                List<NoteService.noteSynBean.TDelListBean> tDeListBeanList = bean.tDelList;

                                //标题同步没有异常
                                List<Integer> errorList = new ArrayList<Integer>();

                                for (NoteService.noteSynBean.TDelListBean tDeListBean : tDeListBeanList) {
                                    if (tDeListBean.dataState == 1) {//新增
                                        if (tDeListBean.state == 0) {//成功
                                            //修改id和状态值
                                            App.getDBcApplication().updateNoteTitleId(tDeListBean.id, tDeListBean.calendId, UserId);
                                            App.getDBcApplication().updateNoteTitleState(tDeListBean.calendId + "", UserId, 0, true);
                                        } else if (tDeListBean.state == 1) {//失败  可以不操作,但是避免意外
                                            //更改状态为1
                                            App.getDBcApplication().updateNoteTitleState(tDeListBean.id + "", UserId, 1, true);
                                        } else if (tDeListBean.state == 2) { //异常
                                            App.getDBcApplication().updateNoteTitleState(tDeListBean.id + "", UserId, -1, true);
                                            errorList.add(tDeListBean.id);
                                        }
                                    } else if (tDeListBean.dataState == 2) {//修改
                                        if (tDeListBean.state == 0) {//成功
                                            //修改该id状态值
                                            App.getDBcApplication().updateNoteTitleState(tDeListBean.id + "", UserId, 0, true);
                                        } else if (tDeListBean.state == 1) {//失败
                                            //更改状态为2
                                            App.getDBcApplication().updateNoteTitleState(tDeListBean.id + "", UserId, 2, true);
                                        } else if (tDeListBean.state == 2) { //异常
                                            App.getDBcApplication().updateNoteTitleState(tDeListBean.id + "", UserId, -1, true);
                                            errorList.add(tDeListBean.id);
                                        }
                                    } else if (tDeListBean.dataState == 3) {//删除
                                        if (tDeListBean.state == 0) {//成功
                                            //删除该id的清单
                                            App.getDBcApplication().deleteNoteTitleData(tDeListBean.id, UserId, true);
                                        } else if (tDeListBean.state == 1) {//失败
                                            //更改状态为3
                                            App.getDBcApplication().updateNoteTitleState(tDeListBean.id + "", UserId, 3, true);
                                        } else if (tDeListBean.state == 2) { //异常
                                            App.getDBcApplication().updateNoteTitleState(tDeListBean.id + "", UserId, -1, true);
                                            errorList.add(tDeListBean.id);
                                        }
                                    }
                                }

                                if (errorList.size() == 0) {

                                    List<NoteService.noteSynBean.ListBean> listBeans = bean.list;
                                    if (listBeans != null) {
                                        for (NoteService.noteSynBean.ListBean listBean : listBeans) {

                                            if (listBean.dataState == 1) {//新增
                                                if (listBean.state == 0) {//成功
                                                    //修改id和状态值
                                                    App.getDBcApplication().updateNoteDetailId(listBean.id, listBean.calendId, UserId);
                                                    App.getDBcApplication().updateNoteTitleDetailState("", listBean.calendId, UserId, 0, true);
                                                } else if (listBean.state == 1) {//失败  可以不操作,但是避免意外
                                                    //更改状态为1
                                                    App.getDBcApplication().updateNoteTitleDetailState("", listBean.id, UserId, 1, true);
                                                } else if (listBean.state == 2) { //异常
                                                    App.getDBcApplication().updateNoteTitleDetailState("", listBean.id, UserId, -1, true);
                                                }
                                            } else if (listBean.dataState == 2) {//修改
                                                if (listBean.state == 0) {//成功
                                                    //修改该id状态值
                                                    App.getDBcApplication().updateNoteTitleDetailState("", listBean.id, UserId, 0, true);
                                                } else if (listBean.state == 1) {//失败
                                                    //更改状态为2
                                                    App.getDBcApplication().updateNoteTitleDetailState("", listBean.id, UserId, 2, true);
                                                } else if (listBean.state == 2) { //异常
                                                    App.getDBcApplication().updateNoteTitleDetailState("", listBean.id, UserId, -1, true);
                                                }
                                            } else if (listBean.dataState == 3) {//删除
                                                if (listBean.state == 0) {//成功
                                                    //删除该id的清单
                                                    App.getDBcApplication().deleteNoteTitledetailData(listBean.id, UserId, true);
                                                } else if (listBean.state == 1) {//失败
                                                    //更改状态为3
                                                    App.getDBcApplication().updateNoteTitleDetailState("", listBean.id, UserId, 3, true);
                                                } else if (listBean.state == 2) { //异常
                                                    App.getDBcApplication().updateNoteTitleDetailState("", listBean.id, UserId, -1, true);
                                                }
                                            }
                                        }
                                    }
                                    sharedPrefUtil.putString(
                                            context,
                                            ShareFile.USERFILE,
                                            ShareFile.UPDATENOTESETTIME,
                                            bean.downTime.replace("T", " "));

                                }
                                Toast.makeText(context, "修改成功", Toast.LENGTH_SHORT).show();
                                callBack.common(beanss.openState == 1 ? 0 : 1, true);
                            } else {
                                callBack.common(beanss.openState == 1 ? 1 : 0, false);
                                Toast.makeText(context, "修改失败", Toast.LENGTH_SHORT).show();
                            }

                        } else {
                            callBack.common(beanss.openState == 1 ? 1 : 0, false);
                            Toast.makeText(context, "修改失败", Toast.LENGTH_SHORT).show();
                        }
                        progressUtil.dismiss();
                        dismiss();
                    }
                });


    }

    private void updateBeanToJsonzone(String titleid) {
        progressUtil.ShowProgress(context, true, true, "正在上传...");
        //标题
        List<NoteTitleDetailBean.ListBean> listBeanList = App.getDBcApplication().getTitleNoteDetailData(UserId, titleid, false);
        JSONObject tDelListBeanListjsonObject = new JSONObject();
        try {

            int num = App.getDBcApplication().getTitleNoteDetailData(beanss.uid + "", beanss.titleId, false).size();
            String title_new;
            if (beanss.styles == 0) {
                int tick = App.getDBcApplication().getNoteDetailEndstateNums(beanss.titleId, beanss.uid + "");
                if (num == 0) {
                    title_new = "";
                } else {
                    title_new = "(" + tick + "/" + num + ")";
                }
            } else if (beanss.styles == 4) {
                int tick1 = App.getDBcApplication().getNoteDetailEndstateNums(beanss.titleId, beanss.uid + "", 1);
                int tick2 = App.getDBcApplication().getNoteDetailEndstateNums(beanss.titleId, beanss.uid + "", 2);
                if (num == 0) {
                    title_new = "";
                } else {
                    title_new = "(" + tick1 + "/" + tick2 + "/" + num + ")";
                }
            } else {
                if (num == 0) {
                    title_new = "";
                } else {
                    title_new = "(" + num + ")";
                }
            }

            JSONArray listjsonArray = new JSONArray();
            JSONObject js = new JSONObject();
            js.put("id", beanss.id);
            js.put("titleId", beanss.titleId);
            js.put("uid", beanss.uid);
            js.put("titles", beanss.titles.equals("") ? (listBeanList.size() > 0 ? listBeanList.get(0).contents : "无标题") : beanss.titles);
            js.put("imgPath", beanss.imgPath);
            js.put("imgUrl", beanss.imgUrl);
            js.put("shareUrl", beanss.shareUrl);
            js.put("filed", beanss.filed);
            js.put("nums", beanss.nums);
            js.put("copys", beanss.copys);
            js.put("styles", beanss.styles);
            js.put("ltype", beanss.ltype);
            js.put("orderId", beanss.orderId);
            js.put("createTime", beanss.createTime);
            js.put("changeTime", beanss.changeTime);
            js.put("localTimes", beanss.localTimes);
            js.put("remark", beanss.remark);
            js.put("remark1", beanss.remark1);
            js.put("remark2", beanss.remark2);
            js.put("remark3", beanss.remark3);
            js.put("remark5", beanss.remark5);
            js.put("remark6", beanss.remark6);
            js.put("remark7", title_new);
            js.put("puid", beanss.puid);
            js.put("pname", beanss.pname);
            js.put("states", beanss.states);
            js.put("sends", beanss.sends);
            js.put("openState", beanss.openState);
            js.put("updateState", beanss.id < 0 ? 1 : App.getDBcApplication().getNoteTitleState(beanss.titleId, UserId));
            listjsonArray.put(js);
            tDelListBeanListjsonObject.put("yunTiltle", listjsonArray);

        } catch (JSONException e) {
            e.printStackTrace();
        }

        //详情
        JSONArray listjsonArray = new JSONArray();
        try {
            for (NoteTitleDetailBean.ListBean bean : listBeanList) {
                JSONObject js = new JSONObject();
                js.put("id", bean.id);
                js.put("titleId", bean.titleId);
                js.put("uid", bean.uid);
                js.put("titles", bean.titles);
                js.put("imgPath", bean.imgPath);
                js.put("imgUrl", bean.imgUrl);
                js.put("shareUrl", bean.shareUrl);
                js.put("contents", bean.contents);
                js.put("nums", bean.nums);
                js.put("style", bean.style);
                js.put("endstate", bean.endstate);
                js.put("lType", bean.lType);
                js.put("orderId", bean.orderId);
                js.put("createTime", bean.createTime);
                js.put("changeTime", bean.changetime);
                js.put("cpath", bean.cpath);
                js.put("curl", bean.curl);
                js.put("remark", bean.remark);
                js.put("remark1", bean.remark1);
                js.put("remark2", bean.remark2);
                js.put("remark3", bean.remark3);
                js.put("remark4", bean.remark4);
                js.put("updateState", bean.id < 0 ? 1 : App.getDBcApplication().getNoteTitleDetailState(bean.titleId, UserId, bean.id));
                listjsonArray.put(js);
            }
            tDelListBeanListjsonObject.put("yunClass1", listjsonArray);
        } catch (JSONException e) {
            e.printStackTrace();
        }

        uploadNoteDatas(tDelListBeanListjsonObject == null ? "" : tDelListBeanListjsonObject.toString());

    }

    private void uploadNoteDatas(String data) {
        HttpUtils httpUtils = new HttpUtils(10000);
        RequestParams params = new RequestParams();
        params.addBodyParameter("data", data);
        httpUtils.send(HttpMethod.POST, URLConstants.复制清单到我的空间, params,
                new RequestCallBack<String>() {

                    @Override
                    public void onFailure(HttpException e, String msg) {
                        Log.e("TAG", "清单同步失败" + msg);
                        dismiss();
                        Toast.makeText(context, "上传失败", Toast.LENGTH_SHORT).show();
                        progressUtil.dismiss();
                    }

                    @Override
                    public void onSuccess(ResponseInfo<String> responseInfo) {
                        if (!TextUtils.isEmpty(responseInfo.result)) {
                            Gson gson = new Gson();
                            ZoneBean bean = gson.fromJson(responseInfo.result, ZoneBean.class);

                            if (bean.status == 0) {
                                Toast.makeText(context, "上传成功", Toast.LENGTH_SHORT).show();
                            } else {
                                Toast.makeText(context, "上传失败", Toast.LENGTH_SHORT).show();
                            }
                        }
                        progressUtil.dismiss();
                        dismiss();
                    }
                });


    }

    class ZoneBean {


        /**
         * status : 0
         * tDelList : null
         * downTime : 2018-06-27T11:26:32
         * message : 成功
         * list : [{"num":"","state":0,"mess":""}]
         * page : null
         * delList : null
         */

        private int status;
        private Object tDelList;
        private String downTime;
        private String message;
        private Object page;
        private Object delList;
        private List<ListBean> list;

        public int getStatus() {
            return status;
        }

        public void setStatus(int status) {
            this.status = status;
        }

        public Object getTDelList() {
            return tDelList;
        }

        public void setTDelList(Object tDelList) {
            this.tDelList = tDelList;
        }

        public String getDownTime() {
            return downTime;
        }

        public void setDownTime(String downTime) {
            this.downTime = downTime;
        }

        public String getMessage() {
            return message;
        }

        public void setMessage(String message) {
            this.message = message;
        }

        public Object getPage() {
            return page;
        }

        public void setPage(Object page) {
            this.page = page;
        }

        public Object getDelList() {
            return delList;
        }

        public void setDelList(Object delList) {
            this.delList = delList;
        }

        public List<ListBean> getList() {
            return list;
        }

        public void setList(List<ListBean> list) {
            this.list = list;
        }

        public class ListBean {
            /**
             * num :
             * state : 0
             * mess :
             */

            public String num;
            public int state;
            public String mess;

            public String getNum() {
                return num;
            }

            public void setNum(String num) {
                this.num = num;
            }

            public int getState() {
                return state;
            }

            public void setState(int state) {
                this.state = state;
            }

            public String getMess() {
                return mess;
            }

            public void setMess(String mess) {
                this.mess = mess;
            }
        }
    }
}
